home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / gnu / include / incl98.zoo / fcntl.h < prev    next >
C/C++ Source or Header  |  1993-07-10  |  3KB  |  102 lines

  1. /*
  2.  *    FCNTL.H
  3.  */
  4.  
  5. #ifndef    _FCNTL_H
  6. #define    _FCNTL_H
  7.  
  8. #ifndef _COMPILER_H
  9. #include <compiler.h>
  10. #endif
  11.  
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15.  
  16. #define    O_RDONLY    0x00        /* read only */
  17. #define    O_WRONLY    0x01        /* write only */
  18. #define    O_RDWR        0x02        /* read/write */
  19. #define O_ACCMODE    0x03        /* used to mask off file access mode */
  20.  
  21. /* file sharing modes (not POSIX) */
  22. #define O_COMPAT    0x00        /* old TOS compatibility mode */
  23. #define O_DENYRW    0x10        /* deny both reads and writes */
  24. #define O_DENYW        0x20
  25. #define O_DENYR        0x30
  26. #define O_DENYNONE    0x40        /* don't deny anything */
  27. #define O_SHMODE    0x70        /* mask for file sharing mode */
  28.  
  29. #define    O_NDELAY    0x100        /* Non-blocking I/O */
  30. #ifdef __MINT__
  31. # define O_SYNC        0x00        /* sync after writes (not implemented) */
  32. #endif
  33.  
  34. /* the following flags are not passed to the OS */
  35. #define    O_CREAT        0x200        /* create new file if needed */
  36. #define    O_TRUNC        0x400        /* make file 0 length */
  37. #define    O_EXCL        0x800        /* error if file exists */
  38. #define    O_APPEND    0x1000        /* position at EOF */
  39. #define _REALO_APPEND    0x08        /* this is what MiNT uses */
  40. #ifndef __MINT__
  41. # define O_PIPE        0x2000        /* serial pipe     */
  42. #endif
  43. #define O_NOCTTY    0x4000        /* do not open new controlling tty */
  44.  
  45. /*
  46.  * defines for the access() function
  47.  */
  48. #define    F_OK            0
  49. #define    X_OK            1
  50. #define    W_OK            2
  51. #define    R_OK            4
  52.  
  53. /*
  54.  * defines for fcntl()
  55.  */
  56. #define    F_DUPFD        0    /* Duplicate fildes */
  57. #define    F_GETFD        1    /* Get fildes flags */
  58. #define    F_SETFD        2    /* Set fildes flags */
  59. #define    F_GETFL        3    /* Get file flags */
  60. #define    F_SETFL        4    /* Set file flags */
  61.  
  62. #ifdef __MINT__
  63. #define F_GETLK        5    /* Get file lock */
  64. #define F_SETLK        6    /* Set file lock */
  65. #define F_SETLKW    7    /* Get lock, wait if busy */
  66.  
  67. struct flock {
  68.     short l_type;
  69. #define F_RDLCK        O_RDONLY
  70. #define F_WRLCK        O_WRONLY
  71. #define F_UNLCK        3
  72.     short l_whence;
  73.     long l_start;
  74.     long l_len;
  75.     short l_pid;
  76. };
  77. #endif /* __MINT__ */
  78.  
  79. /* Mask for close-on-exec bit in the flags retrieved/set by F_GETFD/F_SETFD */
  80. #define FD_CLOEXEC 0x01
  81.  
  82. /* smallest valid gemdos handle */
  83. /* note handle is only word (16 bit) negative, not long negative,
  84.    and since Fopen etc are declared as returning long in osbind.h
  85.    the sign-extension will not happen -- thanks ers
  86. */
  87. #ifdef __MSHORT__
  88. #define __SMALLEST_VALID_HANDLE (-3)
  89. #else
  90. #define __SMALLEST_VALID_HANDLE (0)
  91. #endif
  92.  
  93. __EXTERN int    creat    __PROTO((const char *, unsigned));
  94. __EXTERN int    fcntl    __PROTO((int f, int cmd, ...));
  95. __EXTERN int    open    __PROTO((const char *, int, ...));
  96.  
  97. #ifdef __cplusplus
  98. }
  99. #endif
  100.  
  101. #endif /* _FCNTL_H */
  102.